<h1><a href="/">nightly.link</a></h1>

<p>You have allowed downloads from these repositories:</p>

<% {true, false}.each do |priv| %>
  <h2><% if priv %>Private<% else %>Public<% end %></h2>
  <% any = false %>
  <ul>
  <% installations.each do |inst| %>
    <% (priv ? inst.private_repos : inst.public_repos).each do |repo_name| %>
      <% any = true %>
      <% repo = "#{inst.repo_owner}/#{repo_name}" %>
      <li>
        <a rel="nofollow" target="_blank" href="<%= HTML.escape("https://github.com/#{inst.repo_owner}/#{repo_name}") %>"><%= HTML.escape(repo) %></a>
        <form action="/">
          <label>Insert the GitHub URL of a workflow file that uses <code>upload-artifact</code>:<br/>
          <input name="url" required pattern="<%= HTML.escape(workflow_pattern(inst.repo_owner, repo_name).source) %>" placeholder="<%= HTML.escape(workflow_placeholder(inst.repo_owner, repo_name)) %>" style="width: 80%"></label>
          <input type="submit" value="Get links">
          <% if priv %><input type="hidden" name="h" value="<%= inst.password(repo_name) %>"><% end %>
        </form>
      </li>
    <% end %>
  <% end %>
  </ul>
  <% if priv && any %><p>Note: if you want to change the passwords in the private links, you have to uninstall the GitHub app and install again</p><% end %>
<% end %>

<form action="<%= HTML.escape(RECONFIGURE_URL) %>">
  <input type="submit" value="Change selection">
</form>

<form action="">
  <input type="submit" value="Refresh">
</form>

<script>
  window.history.replaceState(null, "", window.location.href.split("?")[0]);
</script>
